/*
 * @Author: 颜礼田 2564217790@qq.com
 * @Date: 2024-09-10 11:05:38
 * @LastEditors: 颜礼田 2564217790@qq.com
 * @LastEditTime: 2024-09-10 11:21:06
 * @FilePath: /webServerAdmin/src/api/modules/article.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import http from "@/api";
import { PORT1 } from "@/api/config/servicePort";
import { ArticleSchema } from "@/schema";
import { Id, ReqPage } from "../interface";

export function saveArticle(data: ArticleSchema) {
  return http.post<ArticleSchema>(`${PORT1}/article/save`, data);
}

export function fetchArticleInfo(params: Id) {
  return http.get<ArticleSchema>(`${PORT1}/article/info`, params);
}

export function removeArticle(params: Id) {
  return http.delete<ArticleSchema>(`${PORT1}/article/remove`, params);
}

export function editArticle(params: Id, data: ArticleSchema) {
  return http.put<ArticleSchema>(`${PORT1}/article/edit`, data, { params });
}

export function onOffArticle(params: Id) {
  return http.put<ArticleSchema>(`${PORT1}/article/onOff`, {}, { params });
}

export function fetchArticleList(data: ReqPage) {
  return http.post<ArticleSchema[]>(`${PORT1}/article/list`, data);
}
